package main

import (
	"develop_product/controller"
	"develop_product/proto/products"
	"github.com/asim/go-micro/plugins/registry/consul/v3"
	"github.com/asim/go-micro/v3"
	"github.com/asim/go-micro/v3/registry"
)

func main() {
	//register consul
	registry := consul.NewRegistry(func(options *registry.Options) {
		options.Addrs = []string{"43.138.147.44:8500"}
	})

	//register micro
	service := micro.NewService(
		micro.Name("develop_product"),
		micro.Version("latest"),
		micro.Registry(registry),
		micro.RegisterTTL(10),
		micro.RegisterInterval(1),
	)

	//service init
	service.Init()

	products.RegisterProductsHandler(service.Server(),new(controller.Products))

	//service run
	service.Run()
}
